package com.bjsxt.usersCenter.back.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.bjsxt.usersCenter.users.pojo.AAdmins;

@Component("authInterceptor")
public class AuthInterceptor extends HandlerInterceptorAdapter
{

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
	{
		
		String info = "";
		HttpSession session= request.getSession();
		AAdmins admins=(AAdmins) session.getAttribute("admins");
		if(admins!=null)
		{
			return true;
		}
		
		info="非法访问，请先登录";
		request.setAttribute("info", info);
		return super.preHandle(request, response, handler);
	}

	
	
	
	
	
	
	
}
